<template>
  <!-- 六边形节点 -->
  <div class="hexagon-node">
    <slot name="top" />
    <div class="node-content">
      {{ data.label }}
    </div>
    <slot name="bottom" />
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </div>
</template>

<script setup lang="ts">
interface Props {
  id: string
  data: {
    label: string
    nodeType: string
  }
}

defineProps<Props>()
</script>

<style scoped>
.hexagon-node {
  position: relative;
  /* padding: 10px; */
  background: #fff;
  /* border: 1px solid #000; */
  /* border-radius: 4px; */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 80px;
  min-height: 40px;
  /* Phase 1: 显示为矩形，但保持六边形的比例 */
}

.node-content {
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  height: 40px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  color: #000;
  font-weight: 500;
}

.hexagon-node>span {
  position: absolute;
  height: 21px;
  width: 1px;
  background: #000;
  top: 0;
  left:0;
  transform: rotate(20deg);
  transform-origin: top left;
}

.hexagon-node>span:nth-of-type(2){
  top: auto;
  bottom: 0;
  transform: rotate(-20deg);
  transform-origin: bottom left;
}

.hexagon-node>span:nth-of-type(3){
  top: 0;
  right: 0;
  left: auto;
  transform: rotate(-20deg);
  transform-origin: top right;
}

.hexagon-node>span:nth-of-type(4){
  bottom: 0;
  right: 0;
  top: auto;
  left: auto;
  transform: rotate(20deg);
  transform-origin: bottom right;
}


</style>
